import { UserService } from '../user/user.service'
import { Injectable, Inject } from '@nestjs/common'
import { UserEntity } from '../user/user.entity'
import { JwtService } from '@nestjs/jwt';
@Injectable()
export class AuthService {
  constructor(
    // @Inject(UserService)
    // private readonly userService: UserService,
    private readonly jwtService: JwtService,
  ) {}

  async validateUser(): Promise<{}> {
    const payload = {
      id: 4
    };

    return this.createToken(payload);
  }
   async createToken(payload: { id: number }): Promise<string> {
    return this.jwtService.sign(payload)
  }
  //   async validateUser(payload: { id: number }): Promise<UserEntity> {
  //       console.log('zhixinglema?')
  //       return await this.userService.findOneById(payload.id)
  //   }
}
